package com.cwvs.cat.adapter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cwvs.cat.FoundActiveDetailActivity;
import com.cwvs.cat.R;
import com.cwvs.cat.bean.ActiveContent;

public class NumberPickerAdapter extends BaseAdapter {

	private Activity mContext;
	private LayoutInflater inflater;
	private List<String> list_content;

	public NumberPickerAdapter() {
		// TODO Auto-generated constructor stub
	}

	public NumberPickerAdapter(Activity ac, List<String> list) {
		// TODO Auto-generated constructor stub
		this.mContext=ac;
		inflater = LayoutInflater.from(ac);
		this.list_content = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list_content.size();
	}

	@Override
	public Object getItem(int postion) {
		// TODO Auto-generated method stub
		return list_content.get(postion);
	}

	@Override
	public long getItemId(int postion) {
		// TODO Auto-generated method stub
		return postion;
	}

	@SuppressLint("SimpleDateFormat") @Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder viewHolder;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.numberpicker_item,null);
			viewHolder = new ViewHolder();
			viewHolder.num = (TextView) convertView.findViewById(R.id.num);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.num.setText(list_content.get(position));
		return convertView;
	}

	class ViewHolder {
		TextView num;
	}

}